<include  file="common:header" />
<if condition="$orderList neq null">

  <foreach  name="orderList" item="vo">
    <div class="weui-form-preview">

      <div class="weui-form-preview__hd">
        <label class="weui-form-preview__label">付款金额</label>
        <em class="weui-form-preview__value" style="color:#FF8800;">¥{$vo['amount']}</em>
      </div>

      <div class="weui-form-preview__bd">
        <div class="weui-form-preview__item">
          <label class="weui-form-preview__label">订单号</label>
          <span class="weui-form-preview__value">{$vo['ordersn']}</span>
        </div>
        <div class="weui-form-preview__item">
          <label class="weui-form-preview__label">预约时间</label>
          <span class="weui-form-preview__value">{$vo['create_time']|date="Y-m-d H:i:s",###}</span>
        </div>
        <div class="weui-form-preview__item">
          <label class="weui-form-preview__label">所在省市</label>
          <span class="weui-form-preview__value">{$vo['provinceName']['provincename']}{$vo['cityName']['cityname']}</span>
        </div>
        <div class="weui-form-preview__item">
          <label class="weui-form-preview__label">所在医院</label>
          <span class="weui-form-preview__value">{$vo['hospitalName']['hospital_name']}</span>
        </div>
        <div class="weui-form-preview__item">
          <label class="weui-form-preview__label">视频进度</label>
          <if condition="$vo['is_make'] eq 0">
            <span class="weui-form-preview__value" style="color:red">未开始</span>
          <elseif condition="$vo['is_make'] eq 1"/>
            <span class="weui-form-preview__value" style="color:#FF8800">制作中</span>
          <elseif condition="$vo['is_make'] eq 2"/>
            <span class="weui-form-preview__value" style="color:green">制作完成</span>
          </if>
        </div>
        <div class="weui-form-preview__item">
          <label class="weui-form-preview__label">订单状态</label>
          <if condition="$vo['is_pay'] eq 1">
            <span class="weui-form-preview__value" style="color:green">已付款</span>
          <elseif condition="$vo['is_make'] eq 0"/>
            <span class="weui-form-preview__value" style="color:red">未付款</span>
          </if>
        </div>
      </div>

      <!-- 查看信息 -->
      <div class="weui-form-preview__ft">

        <input type="hidden" class="ordersn" value="{$vo['ordersn']}"/>

        <if condition="$vo['is_pay'] eq 0">
          <button type="submit" class="weui-form-preview__btn weui-form-preview__btn_primary" onclick="window.location.href='{:U(MODULE_NAME.'/personal/compelete_infomation',array('ordersn'=>$vo['ordersn'],'type'=>'edit'))}';" style="color:#FF8800;">完善信息</button>
          <button type="submit" class="weui-form-preview__btn weui-form-preview__btn_primary" onclick="window.location.href='{:U(MODULE_NAME.'/index/confirm',array('ordersn'=>$vo['ordersn']))}';">去付款</button>
        <elseif condition="$vo['is_pay'] eq 1 AND $vo['is_make'] eq 0"/>
            <button type="submit" class="weui-form-preview__btn weui-form-preview__btn_primary" onclick="window.location.href='{:U(MODULE_NAME.'/personal/compelete_infomation',array('ordersn'=>$vo['ordersn'],'type'=>'edit'))}';" style="color:#FF8800;">完善信息</button>
        <elseif condition="$vo['is_pay'] eq 1 AND $vo['is_make'] eq 2"/>
            <button type="submit" class="weui-form-preview__btn weui-form-preview__btn_primary" onclick="window.location.href='{:U(MODULE_NAME.'/personal/compelete_infomation',array('ordersn'=>$vo['ordersn'],'type'=>'look'))}';" style="color:#FF8800;">查看信息</button>
        </if>

      </div>
      <!-- 查看信息 -->

    </div>

    <div class="weui-cells__title"></div>
  </foreach>

<else/>
 暂无订单
</if>


<script type="text/javascript">
   $('.cancel_book').click(function(){
  var ordersn = $(this).siblings('.ordersn').val();
  $.ajax({
    url:"{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/cancel_order')}",
    type: 'post',
    dataType: 'json',
    data: {ordersn:ordersn},
    success:function(data){
      if (data.status == 1){
        $.toast(data.info , function() {
          window.location.href = data.url;
        });
        /* layerCallBackTips(data.info,data.url); */
      }else{
        $.toast(data.info,'cancel', function() {
          window.location.href = data.url;
        });
  /* layerCallBackTips(data.info); */
      }
    }
  });
});

//付款前的检测-需求：（付款前需要完善信息）
function payForCheck(obj){
  var ordersn = $(obj).next().val();
  $.post("{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/payForCheckInfo')}", {ordersn: ordersn}, function(data) {
    console.dir(data);
    if (data.status) {
      //完善信息--填完
      window.location.href='{:U(MODULE_NAME.'/index/confirm',array('ordersn'=>$vo['ordersn']))}';
    }else{
      //完善信息--未填完
      $.toast(data.info , function() {
      window.location.href='{:U(MODULE_NAME.'/personal/compelete_infomation',array('ordersn'=>$vo['ordersn'],'type'=>'edit'))}';
      });
    }
  });
}

</script>

